package xxm.util;

import java.io.File;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Utility {
	public static boolean isNum(String str) {
		Pattern pattern = Pattern.compile("[0-9]*");
		Matcher isNum = pattern.matcher(str);
		if (!isNum.matches()) {
			return false;
		}
		return true;
	}
	
	public static String getSystemEnv(String strKey, String strFile ) {
		Map map = System.getenv();
		String strValue = map.get(strKey).toString();
		return strValue + strFile;
	}
	
	/**
	 * check file exits
	 * @param fileName
	 * @return
	 */
	public static boolean checkFileExists( final String fileName) {
		boolean bRet = false;
		try {
			File file = new File(fileName);
			bRet =  file.exists();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return bRet;
	}
}
